package com.cari.oa.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;

@Entity
@Table(name = "T_MARKETPROJECT")
public class MarketProjectEntity implements Serializable {

	private static final long serialVersionUID = -6734178121629799300L;

    @Id
    @Length(max = 32)
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    private String id;
    
    @NotNull(message = "项目名称不能为空")
    @Length(max = 100, message = "项目名称长度要小于100个字符")
    private String name;//项目名称
    
    @NotNull(message = "项目编号不能为空")
    @Length(max = 50, message = "项目编号长度要小于32个字符")
    private String code;//项目编号 user_yymmdd_顺序号2位
    
    @NotNull(message = "省份不能为空")
    @Length(max = 32, message = "省份ID长度要小于32个字符")
    private String province;//所属省份
    
    @NotNull(message = "项目描述不能为空")
    private String description;//项目描述
    
    @NotNull(message = "最后一次修改时间不能为空")
    @Column(name = "LAST_MODIFY_TIME")
    private Date lastModifyTime;//最后一次修改时间
    
    @NotNull(message = "申请人不能为空")
    @Length(max = 32, message = "申请人ID长度要小于32个字符")
    @Column(name = "APPLY_USER")
    private String applyUser;//申请人
    
    @NotNull(message = "申请时间不能为空")
    @Column(name = "APPLY_TIME")
    private Date applyTime = new Date();//申请时间
    
    @NotNull(message = "经办人不能为空")
    @Length(max = 100, message = "经办人长度要小于100个字符")
    private String operator;//经办人
    
    @Column(name = "EXPECTED_TIME")
    private Date expectedTime;//预计实现时间
    
    @Column(name = "EXPECTED_SCALE")
    private String expectedScale;//预计规模
    
    @NotNull(message = "客户联系人不能为空")
    @Length(max = 200, message = "客户联系人长度要小于200个字符")
    private String connector;//客户联系人
    
    @Length(max = 100, message = "用户单位名称长度要小于100个字符")
    @Column(name = "CUSTOMER_COMPANY")
    private String customerCompany;//用户单位名称
    
    @Length(max = 50, message = "联系人名称长度要小于100个字符")
    @Column(name = "CUSTOMER_CONTACTOR")
    private String customerContactor;//用户联系人
    
    @Length(max = 20, message = "联系人电话长度要小于20个字符")
    @Column(name = "CUSTOMER_PHONE")
    private String customerPhone;//用户联系人电话
    
    @Column(name = "Status")
    private String status = "0";//项目状态
    
    @Transient
    private String applyCnname;
    
    @Transient
    private String statusName;

	
	public MarketProjectEntity(String id, String name) {
		
		this.applyTime = null;
		this.status = null;
		this.id = id;
		this.name = name;
	}

	public MarketProjectEntity(){}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getLastModifyTime() {
		return lastModifyTime;
	}

	public void setLastModifyTime(Date lastModifyTime) {
		this.lastModifyTime = lastModifyTime;
	}

	public String getApplyUser() {
		return applyUser;
	}

	public void setApplyUser(String applyUser) {
		this.applyUser = applyUser;
	}

	public Date getApplyTime() {
		return applyTime;
	}

	public void setApplyTime(Date applyTime) {
		this.applyTime = applyTime;
	}

	public String getOperator() {
		return operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public Date getExpectedTime() {
		return expectedTime;
	}

	public void setExpectedTime(Date expectedTime) {
		this.expectedTime = expectedTime;
	}

	public String getExpectedScale() {
		return expectedScale;
	}

	public void setExpectedScale(String expectedScale) {
		this.expectedScale = expectedScale;
	}

	public String getConnector() {
		return connector;
	}

	public void setConnector(String connector) {
		this.connector = connector;
	}

	public String getCustomerCompany() {
		return customerCompany;
	}

	public void setCustomerCompany(String customerCompany) {
		this.customerCompany = customerCompany;
	}

	public String getCustomerContactor() {
		return customerContactor;
	}

	public void setCustomerContactor(String customerContactor) {
		this.customerContactor = customerContactor;
	}

	public String getCustomerPhone() {
		return customerPhone;
	}

	public void setCustomerPhone(String customerPhone) {
		this.customerPhone = customerPhone;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
	
	public String toString()
	{
		StringBuffer sb = new StringBuffer();
		sb.append("{id:'"+this.getId()+"',name:'"+this.getName());
		if(this.getStatusName() != null)
			sb.append(this.getStatusName());
		if(this.getApplyCnname() != null)
			sb.append(this.getApplyCnname());
		sb.append("'}");
		return sb.toString();
	}

	public String getStatusName() {
		return statusName;
	}

	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}

	public String getApplyCnname() {
		return applyCnname;
	}

	public void setApplyCnname(String applyCnname) {
		this.applyCnname = applyCnname;
	}
}
